package graphics;

import java.awt.Component;
import java.awt.Frame;
import java.awt.Label;
import java.awt.List;
import java.awt.Panel;
import java.awt.TextArea;
import java.awt.TextComponent;
import java.awt.TextField;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class TestAWT extends Frame {
	// les classes que tenen una J davant venen de SWING
	// les que no, son de AWT

	private static final long serialVersionUID = 1L;
	private Panel panel;
	private Label lNombre, lApellidos, lObs;
	private TextField nombre, apellidos;
	private TextArea observaciones;
	private List aficiones;
	
	public TestAWT() {

		setBounds(200, 200, 600, 600);
		setVisible(true);
		inicializaGUI();
	}

	private void inicializaGUI() {
		// setLayout(null);
		panel = new Panel(null);
		
		lNombre = new Label("Nom:");
		lNombre.setBounds(10, 10, 90, 20);		
		lApellidos = new Label("Cognoms:");
		lApellidos.setBounds(10, 50, 90, 20);		
		lObs = new Label("Observacions:");
		lObs.setBounds(10, 90, 90, 20);

		nombre = new TextField();
		nombre.setBounds(100, 10, 120, 20);		
		apellidos = new TextField();
		apellidos.setBounds(100, 50, 120, 20);
		observaciones = new TextArea();
		observaciones.setBounds(100, 90, 200, 200);
		
		panel.add(lNombre);
		panel.add(lApellidos);
		panel.add(lObs);
		
		panel.add(nombre);
		panel.add(apellidos);
		panel.add(observaciones);
		
		this.add(panel);
		// s'ha d'afegir el manejador al control que volguem manejar ???
		
		
		ItemListener controladorItemLista = new ItemListener(){
			public void ItemStateManager(ItemEvent e){
				String item = (String) e.getItem();			
			}

			@Override
			public void itemStateChanged(ItemEvent e) {
				// TODO Auto-generated method stub
				
			}
		}
		ActionListener controladorReturn = new ActionListener(){
			@Override
			public
		}
		MouseAdapter controladorRatoli = new MouseAdapter(){
			@Override
			String mensaje= "HOLAKEASE?";
			JOptionPane
			
		};
		
		FocusListener controladorFoco = new FocusListener(){
			@Override
			public void focusGained (FocusEvent e){
				Component comp = e.getComponent();
				TextComponent tComp = (TextComponent) comp;
			}
			public void focusLost (FocusEvent e){}
		};
		
		
	}

	public static void main(String[] args) {

		TestAWT programa = new TestAWT();
		programa.addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				System.exit(0);
			}
		});

	}

}
